Skip to content

ipni: drop ad-fetch tracking, return adCid in piece status instead - #1450

Open
beck-8 wants to merge 1 commit into
mainfrom
feat/ipni-piece-status-adcid
Open

ipni: drop ad-fetch tracking, return adCid in piece status instead#1450
beck-8 wants to merge 1 commit into
mainfrom
feat/ipni-piece-status-adcid

Conversation

@beck-8

@beck-8 beck-8 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

#1426 (comment)
His follow-up update. Replace #1426 @BigLep @LexLuthr @jennijuju

I chose to add the return adCid, so that the caller can choose his own check logic.
Users should verify the advertised information, but should not rely on the advertisedAt date. After confirming the advertised details, users should continue to check the ad's status and the cid.

Summary of Changes

  1. ipni-provider.go: Dropped ipni_ad_fetches writes; fixed a bug where LastPublishTime never got set after a restart; PublishInterval 5s → 1s.
  2. pdp/handlers.go: Removed retrieved/synced fields, added adCid so callers can check sync status against the indexer themselves; advertised/advertisedAt logic unchanged.
  3. pdp/README.md: Updated docs for the new response fields.
  4. Added SQL migration to drop the ipni_ad_fetches table, with matching downgrade.

@beck-8 beck-8 self-assigned this Aug 21, 2026
@beck-8
beck-8 requested review from a team and ZenGround0 as code owners August 21, 2026 06:40
@FilOzzy FilOzzy added the team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10 label Aug 21, 2026
@FilOzzy FilOzzy added this to FOC Aug 21, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Aug 21, 2026
@beck-8

beck-8 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

If you think it is inappropriate to throw out the Ad information and let the user inquire by himself. And accepting this interface will be stuck, so you can put this part of the check in curio (I can't accept this kind of thing very well, and this is a remote call. You can call the interface of curio frequently to make curio frequently want to initiate cid requests. To handle this part, you need to add more Add cache status).

@BigLep BigLep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @beck-8 . This is interesting. I like the thinking of getting Curio out of being the "middle-man" between a client (e.g., Dealbot) and an IPNI instance (e.g., cid.contact). dealbot can just query cid.contact directly to determine whether the advertisment has been ingested.

I'm trying to think of any downsides of taking Curio out of the loop. I don't understand failure cases enough to know, but is there a world where it would be beneficial for Curio to know that a client's cids haven't been indexed yet by cid.contact?

Other things I would imagine adding in the PR:

  • In the return struct, lets include the ipniInstance that the adCid was advertised to. I don't want client's hardcoding cid.contact.
  • I think it would be good if the return structure also accounted for potentially multiple ipniInstances.
  • (I'm suggesting the above so that we don't need to worry about client updates. Updating SPs is easier I think that getting clients to update if we ever added a different/additional IPNI instance besides cid.contact.)

I defer to @LexLuthr on final decisions here.

Comment thread pdp/README.md
- `adCreatedAt`: Timestamp the advertisement was created (omitted if not yet created).
- `adCid`: This piece's advertisement CID, once created. Curio doesn't check whether an indexer finished processing it - callers can, e.g. `GET https://cid.contact/sync/status/ad/{adCid}`.
- `advertised`: Whether the provider has sent an HTTP announce covering this ad.
- `advertisedAt`: Approximate, not a fixed record: it's the last known successful announce time for the *provider*, not this ad specifically, so it can drift forward on later calls once the provider announces newer ads, and is lost on a Curio restart (the provider re-announces its current head once on startup to recover it).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the last known successful announce time for the provider, not this ad specifically,

Is that because we're no longer storing state in the database (memory only), or has this always been the case. I would have thought we could be more precise with ourselves on the first advertising chain we announced that includes this adCid. If we don't know that, then I think we should drop this field.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that there are three layers of judgment:

  1. The first layer is determined by whether ipni comes to fetch, and we delete this logic here. This is fixed
  2. The second layer is inferred by time. This will be offset.
  3. The third floor is a pocket bottom, fixed time

So here we have to make a choice, either to retain the original logic or possibly delete everything? Only keep the state?

@beck-8

beck-8 commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Curio to know that a client's cids haven't been indexed yet by cid.contact?

I saw that there was another alarm in the previous design. It is to judge the gap between head and cid. Curio will send an alarm 1 hour behind.

I don't want client's hardcoding cid.contact.

I've thought about this, but I don't have a good idea at present. Because there are two cid and filecoinpin now, two can be returned here, because both of them push head, but one of them does not have an ad status interface. Or the configuration we add to curio after this time must be a completely equal ipni node. That is to say, delete filecoinpin this time, otherwise, he will return two ipni.
What I prefer is that the two ipni become completely equal instances. Then we follow the migration process, release it first, and then delete one. But how should I use it when I get two IPNI results downstream?

I reconsidered it. This part is not elegant. And it is our consensus which IPNI to use now. It does not allow mistakes or problems. This website has been hard-coded in many downstream places. If you want to replace it, you need everyone to replace it

I will make changes when I get more input from you.

@BigLep

BigLep commented Aug 22, 2026

Copy link
Copy Markdown
Member

HI @beck-8 - thanks for engaging. I'll let @LexLuthr make the calls here as he knows more of the specifics.

In general, I want to make sure we have some flexibility in our system to not always assume cid.contact. If cid.contact has problems again we'll likely spin up our own IPNI instance (not the current filecoinpin.contact with bespoke logic but a storetheindex instance that has the same endpoints as cid.contact). It would be great if that could "just work" by having SPs update config to use it and not require server API code and client code for that to work... But if that is too much extra we can bite the bullet then. My general position is I want to be able to adapt quickly on the content routing front, and API flexibility is one area where I think we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants